<%--
  Created by IntelliJ IDEA.
  User: Chen
  Date: 2016/3/14
  Time: 13:26
  To change this template use File | Settings | File Templates.
--%>
<%--
  Created by IntelliJ IDEA.
  User: Chen
  Date: 2016/3/6
  Time: 15:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<h2>
    ${empty topic.id?"在线出题":"查看题目"}
</h2>
<div class="error class alert-danger" style="display: none;padding:10px 0 8px 10px"></div>
<form id="topic-form"  class=" form-horizontal " role="form" style="padding-left: 20px">
    <div class="row">
        <div class="col-md-8">
            <input type="hidden" id="id" name="id" value="${topic.id}">
            <input type="hidden" id="curRole" name="curRole" value="${curUser.role.id}">

            <div class="form-group">
                <label for="name" class=" col-sm-2 control-label"> 题目：</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm "  style="font-weight: 500;font-size: 18px; height: 42px;" id="name" name="name" value="${topic.name}">
                </div>
            </div>

            <div class="form-group">
                <label for="type" class="col-sm-2 control-label">类型：</label>
                <div class="col-sm-4">
                    <c:forEach items="${fns:getDictList('topic_type')}" var="dict">
                        <input type="radio" id="radio${dict.id }"  class=" typeDisable"  id="type" name="type" ${topic.type==dict.value?"checked":""} value="${dict.value }"> ${dict.label }
                    </c:forEach>
                </div>
            </div>

            <shiro:hasPermission name="tch:menu:edit">
            <div class="form-group">
                <label for="source" class="col-sm-2 control-label">来源：</label>
                <div class="col-sm-9">
                    <c:forEach items="${fns:getDictList('topic_tch_source')}" var="dict">
                        <input type="radio" id="radio${dict.id }" id="source" name="source" ${topic.source==dict.value?"checked":""} value="${dict.value }"> ${dict.label }
                    </c:forEach>
                </div>
            </div>
            </shiro:hasPermission>

            <shiro:hasPermission name="tch:menu:edit">
            <div class="form-group">
                <label for="restriction" class=" col-sm-2 control-label">限制人数：</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control input-sm"  id="restriction" name="restriction" value="${topic.restriction}">
                </div>
            </div>
            </shiro:hasPermission>


            <div class="form-group">
                <label for="description" class=" col-sm-2 control-label">题目描述：</label>
                <div class="col-sm-10">
                    <textarea name="description" id="description"  rows="10px" class="form-control input-sm required"  >${topic.description}</textarea>
                </div>
            </div>

            <shiro:hasPermission name="std:menu:edit">
            <div class="form-group">
                <label for="directTeacher" class=" col-sm-2 control-label">指导老师：</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control input-sm"  id="directTeacher" name="directTeacher.id" value="${topic.directTeacher.id}">
                </div>
            </div>
            </shiro:hasPermission>

            <div style="clear: both">
                <button id="topic-submit" class="btn btn-primary btn-sm" type="button">选 择</button>
                <button id="topic-cancel" class="btn btn-sm" type="button" onclick="history.go(-1)">返 回</button>
            </div>
        </div>
    </div>
</form>


<script>
    <c:if test="${env == 'pro' }">
    requirejs(['${ctx}/assets/js/app/system/topic-form-page.js']);
    </c:if>
    <c:if test="${env != 'pro' }">
    requirejs(['${ctx}/assets/js/app/system/topic-form-page.js']);
    </c:if>

</script>

